package com.kimehwa.studyboot.schedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author xiaodongguan
 * @description
 * @since 2021-08-30 11:46
 */
@Slf4j
@Component
//@EnableScheduling
public class TaskOne {

    /**
     * 每隔10秒执行test1()
     */
    @Scheduled(cron = "*/10 * * * * ?")
    public void test1() {
        log.info("=========test1任务启动============");
        try {
            Thread.sleep(7 * 1000L);
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("=========test1任务结束============");
    }


}
